package day1;
import java.util.*;
/**
 * @author oldliu
 * @since 1.0
 */
public class ListCollectionsTest {
    public static void main(String[] args) {
        List<Integer> list=new ArrayList<>();
        //int ->Integer
        list.add(12);
        for(int i=1;i<=30;i++){
            list.add((int) (Math.random()*100));
        }
        System.out.println("排序前：");
        System.out.println(list);
        System.out.println("排序后：");
        Collections.sort(list);
        Collections.reverse(list);
        System.out.println(list);
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        List<Pet> list2=new ArrayList<>();//自动推导
        list2.add(new Pet("小花花",100,55));
        list2.add(new Pet("大黄",66,65));
        list2.add(new Pet("旺财",55,66));
        list2.add(new Pet("哮天犬",44,100));
        list2.add(new Pet("Jiasting",59,33));
        list2.add(new Dog("贾斯汀",100,100,"美利坚流浪狗"));
        Collections.sort(list2);
        System.out.println("duixiang bijiao hou :");
        for(Pet p:list2)
            System.out.println(p);
    }
}
